<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
            
         
            <!--app-->
       <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-color.css">
        <link rel="stylesheet" href="css/appcan.icon.css">
        <link rel="stylesheet" href="css/appcan.control.css">
        <link rel="stylesheet" href="css_sdk/css/main.css"> 
        <link rel="stylesheet" href="test_content/css/list.css">
           <!--amazeui-->
        <link rel="stylesheet" href="assets/css/amazeui.min.css">
        <link rel="stylesheet" href="assets/css/app.css">
        <style>
        .c-org-b1 {
                background-color: #ff6e8f;
            }
        .c-org-b2 {
           background-color: #76d0b6;
        }
        .c-org-b3 {
           background-color: #face4b;
        }
        .c-org-b4 {
           background-color: #82afe8;
        }
        .am-navbar-default .am-navbar-nav {
            background-color: #ffffff;
        }
        .am-navbar-default a, .am-navbar-one a {
            color: #afb7b9;
        }
        
        .am-header-default {
            background-color: #ffffff;
        }

        ol, ul {
             padding-left: 0em; 
        }
        .lis-icon {
            width: 7em;
            margin: 0em 0.4em 0em 0px;
            min-height: 8em;
        }
        
        .am-titlebar-black{
            /*color: #0e90d2;*/
            margin-right: 15px;
            /*border-bottom: 2px solid #0e90d2;*/
            font-weight: 700;
        }
        .am-titlebar {
            margin-top: 0px;
            height: 45px;
            font-size: 100%;
        }
        .am-titlebar-cols, .am-titlebar-multi {
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            background-color:white;
        }
        *+address, *+blockquote, *+dl, *+fieldset, *+figure, *+hr, *+ol, *+p, *+pre, *+ul {
            margin-top: 0rem;
        }
        address, blockquote, dl, fieldset, figure, hr, ol, p, pre, ul {
            margin: 0rem;
        }
        .am-titlebar-cols .am-titlebar-title {
            color: #b22222;
            margin-right: 15px;
            border-bottom: 2px solid #b22222;
            font-weight: 700;
        }
        .am-titlebar-cols .am-titlebar-title a {
            color: black;
        }
        
        ol>li>ol, ol>li>ul, ul>li>ol, ul>li>ul {
             margin: 0em; 
        }
        
        .text-red {
                color: #eb1111;
            }
            .sc-text-active {
                color: black !important;
                font-weight:  bold;
            }
            .bg-b{
                border-bottom: 2px #eb1111 solid;
            }
             .bc-top {
                background-color: #626262;
            }
            .bc-head {
                background-color: #FFFFFF;
                padding-top: 0.3em;
                padding-bottom: 0.3em;
                border-bottom: 1px #BABABA solid;
                padding-left: 0.3em;
            }
            
            .uwh-pSC1 {
                width: 1.6em;
                height: 1.5em;
            }

        
        </style>


		<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript">

		var retData;
                //没有登录时的菜单
                var menuData;
		
		var retuid=sessionStorage.getItem("retuid");
		var retuname=sessionStorage.getItem("retuname");

		var loginID=localStorage.getItem("user");
		var categoryID=sessionStorage.getItem("categoryID");
		var productCD=sessionStorage.getItem("productCD");

		function activeCat(catid){
                    if(loginID=="" || loginID==null){
                        $.ajax({
                            type: 'POST',
                            async:false,
                            url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/HuiyuanManageWebService/GetUserItemList" ,
                            data: {},
                            success: function(data){
                                menuData=data;
                            },
                            dataType: "json",
                        });
                    }
                        $.ajax({
				type: 'POST',
				async:false,
				url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/CaigouManageWebService/OrderListInit" ,
				data: {"ID":loginID,"CategoryID":catid,"ProductCD":productCD},
				success: function(data){
					retData=data;
				},
				dataType: "json",
			});
                    
			//sessionStorage["categoryID"]=catid;

			setContent(retData,menuData);
			conCss(catid);
			
		}

		function conCss(temp){
			var obj=document.getElementById("cat"+temp+"cat");
			obj.className=obj.className+' sc-text-active';

			var obj1=document.getElementById("cat"+temp+"");
			obj1.className=obj1.className+' bg-b';

		}

		$(document).ready(function(){
                   if(loginID=="" || loginID==null){
                        $.ajax({
                            type: 'POST',
                            async:false,
                            url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/HuiyuanManageWebService/GetUserItemList" ,
                            data: {},
                            success: function(data){
                                retData=data;
                            },
                            dataType: "json",
                        });
                        activeCat(retData[0]["ItemList"][0].f1);
                    }else{
			$.ajax({
				type: 'POST',
				async:false,
				url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/CaigouManageWebService/OrderListInit" ,
				data: {"ID":loginID,"CategoryID":categoryID,"ProductCD":productCD},
				success: function(data){
					retData=data;
				},
				dataType: "json",
			});
                        activeCat(retData[0]["catList"][0].f1);
                    }
                    
                    //setContent(retData);
		    //conCss(0);

		});

		function setContent(retData,menuData){
			if(retData==false){
				alert("空");
			}else{
				var htm="<div id='cat0' class='ulev-1 ub ub-f1 ' data-index='0'> <div id='cat0cat' class='ub-f1 ub ub-ver item ub-ac sc-text-tab '><div class='ulev tx-c' onclick='activeCat("+0+")'>全部</div></div></div>";
                                htm="";
                                if(loginID==""){
                                    $.each(menuData[0]["ItemList"],function(idx,item){
					var ht="<div id='cat"+item.f1+"' class='ulev-1 ub ub-f1' data-index='2'> <div id='cat"+item.f1+"cat' class='ub-f1 ub ub-ver item ub-ac sc-text-tab'> <div class='ulev tx-c t-gra-85' onclick='activeCat("+item.f1+")'>"+item.f2+"</div> </div> </div>";
					//商品分类列表List
					htm=htm+ht;
                                    });
                                }else{
                                    $.each(retData[0]["catList"],function(idx,item){
					var ht="<div id='cat"+item.f1+"' class='ulev-1 ub ub-f1' data-index='2'> <div id='cat"+item.f1+"cat' class='ub-f1 ub ub-ver item ub-ac sc-text-tab'> <div class='ulev tx-c t-gra-85' onclick='activeCat("+item.f1+")'>"+item.f2+"</div> </div> </div>";
					//商品分类列表List
					htm=htm+ht;
                                    });
                                }
				
				$("#cat").html(htm);

				htm="<ul>";
				$.each(retData[0]["productDetail"],function(idx,item){
					ht="<li class='ubb ub bc-border t-bla ub-ac lis' data-index='0'>"+
					"<ul class='ub ub ub-ver' onclick=openwin('detail.html?id="+item.f2+"')><li class=''><div class='lis-icon ub-img' "+"style='background-image:url(http://101.200.158.44/SyxView/UpImages/Product/"+item.f1+")'></div><div class='ulev-1 bc-text umar-t'></div></li></ul>"+
            "<ul class='ub-f1 ub ub-pj ub-ac'>"+
                "<ul class='ub-f1 ub ub-ver marg-l'>"+
                    "<li class='bc-text ub ub-ver ut-m line1'  onclick=openwin('detail.html?id="+item.f2+"')>"+item.f3+"</li>"+
                    "<li class='bc-text ub ub-ver ut-m line1 ulev-4'  onclick=''>限购数量："+item.f8+"</li>"+
                    "<li class='bc-text ub ub-ver ut-m line1 ulev-4' style='color:#c10802' onclick=openwin('detail.html?id="+item.f2+"') >零售价："+item.f7+"元</li>"+
                    "<li class='sc-text1 uinn3' >"+
                        "<div class='ub umar-t ub-ac'> "+              
                            "<div class='ub ub-pe ub-f1' style='color: gray'>"+
                                "<div onclick='del("+item.f2+")' class=' uwh-pSC1 tx-c uba bc-border uc-a-app1 t-bla mar-ar1'>-</div> "+
                                "<div class='uba uc-a-app1 bc-border uinput uwh-pSC1 mar-ar1 c-wh'><div id='"+item.f2+"' placeholder='2' type='text' class='uinn-pSC3 t-bla "+"tx-c'>0</div></div>"+
                                "<div onclick='add("+item.f2+")' class='ub ub-pc ub-ac uwh-pSC1 tx-c uba bc-border uc-a-app1 t-bla'>"+
                                    "<div >+</div></div> </div></div></li></ul>  </ul> </li>";
					//商品分类列表List
					htm=htm+ht;
				})
				htm=htm+"</ul>";
				$("#listview").html(htm);
                                sessionStorage["retData"]=JSON.stringify(retData);
                                
				if(retuid==null&&loginID!=""){
					sessionStorage["retuid"]=retData[0]["userList"][0]['f1'];
					sessionStorage["retuname"]=retData[0]["userList"][0]['f2'];
					retuid=sessionStorage.getItem("retuid");
					retuname=sessionStorage.getItem("retuname");
				}
				$("#uname").html(retuname);
                              
				

			}
		}
                
                function checkLogin(){
                    if(loginID==undefined||loginID==""||loginID==null){
                        window.location.href="login.html";
                    }
                }

		function del(id){
                    checkLogin();
			if(parseInt($("#"+id).text())>0){
				$("#"+id).text(parseInt($("#"+id).text())-1);

				$.ajax({
					type: 'POST',
					url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/CaigouManageWebService/AddOrderData" ,
					data: {"ID":loginID,"UserID":retuid,"ProductCD":id,"Qty":-1},
					success: function(data){
						//alert(data[0]['Result']);
					},
					dataType: "json",
				});
			}
		}
		function add(id){
                    checkLogin();
			$("#"+id).text(parseInt($("#"+id).text())+1);

			$.ajax({
				type: 'POST',
				url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/CaigouManageWebService/AddOrderData" ,
				data: {"ID":loginID,"UserID":retuid,"ProductCD":id,"Qty":1},
				success: function(data){
					//alert(data[0]['Result']);
				},
				dataType: "json",
			});


		}
</script>
</head>

<body class="um-vp bc-bg" >
    
    
    <div id="header" class="uh bc-text-head ub bc-head ub-ver">
        <div class="ub" onclick="openwin('usearch.html')">
             <div class="ub-f2" style="color:#c10802;font-size: 1em;font-weight: bold" >会员选择  </div>

             <div class="ub-f1 ub ub-pe ub-ac" style="color:black;font-size: 1em">
                 <div id="uname"></div>
                 <div><img src="images/go.png" style="width:1.4em"/></div>
             </div>
         </div>
    </div>

   

    
<div class="uf t-bla ub tab_l " style=" background-color: white" id="cat">

<!--
           <div class="ulev-1 ub ub-f1 bg-b" data-index="0">
               <div class="ub-f1 ub ub-ver item ub-ac sc-text-tab sc-text-active">
                   <div class="ulev tx-c">全部</div>    
               </div>
           </div>
            <div class="ulev-1 ub ub-f1" data-index="2">
               <div class="ub-f1 ub ub-ver item ub-ac sc-text-tab">
                   <div class="ulev tx-c t-gra-85">护肤品</div>
               </div> 
           </div>
            <div class="ulev-1 ub ub-f1" data-index="2">
               <div class="ub-f1 ub ub-ver item ub-ac sc-text-tab">
                   <div class="ulev tx-c t-gra-85">面膜</div>
               </div> 
           </div>  
           <div class="ulev-1 ub ub-f1" data-index="2">
               <div class="ub-f1 ub ub-ver item ub-ac sc-text-tab">
                   <div class="ulev tx-c t-gra-85">扶中罐套装</div>
               </div> 
           </div> 
		   -->
       </div>
    
<div id="listview">
<!--
    <ul>
        <li class="ubb ub bc-border t-bla ub-ac lis" data-index="0">
            <ul class="ub ub ub-ver" onclick="openwin('detail.html')"><li class=""><div class="lis-icon ub-img" style="background-image:url(images/temp1.png)"></div><div class="ulev-1 bc-text umar-t"></div></li></ul>
            <ul class="ub-f1 ub ub-pj ub-ac">
                <ul class="ub-f1 ub ub-ver marg-l">
                    <li class="bc-text ub ub-ver ut-m line1"  onclick="openwin('detail.html')">扶中罐护肤套装</li>
                    <li class="bc-text ub ub-ver ut-m line1 ulev-4"  onclick="openwin('detail.html')">保质期：3个月</li>
                    <li class="bc-text ub ub-ver ut-m line1 ulev-4" style="color:#c10802" onclick="openwin('detail.html')" >零售价：765元</li>
                    <li class="sc-text1 uinn3" >
                        <div class="ub umar-t ub-ac">               
                            <div class="ub ub-pe ub-f1" style="color: gray">
                                <div ontouchstart="appcan.touch('btn-act')" class=" uwh-pSC1 tx-c uba bc-border uc-a-app1 t-bla mar-ar1">-</div> 
                                <div class="uba uc-a-app1 bc-border uinput uwh-pSC1 mar-ar1 c-wh"><div placeholder="2" type="text" class="uinn-pSC3 t-bla tx-c">0</div></div>
                                <div ontouchstart="appcan.touch('btn-act')" class="ub ub-pc ub-ac uwh-pSC1 tx-c uba bc-border uc-a-app1 t-bla">
                                    <div >+</div>
                                </div> 
                            </div>
                        </div>
                    </li>
                </ul>    
            </ul>
        </li>
        
        <li class="ubb ub bc-border t-bla ub-ac lis" data-index="0">
            <ul class="ub ub ub-ver" onclick="openwin('detail.html')"><li class=""><div class="lis-icon ub-img" style="background-image:url(images/temp1.png)"></div><div class="ulev-1 bc-text umar-t"></div></li></ul>
            <ul class="ub-f1 ub ub-pj ub-ac">
                <ul class="ub-f1 ub ub-ver marg-l">
                    <li class="bc-text ub ub-ver ut-m line1"  onclick="openwin('detail.html')">扶中罐护肤套装</li>
                    <li class="bc-text ub ub-ver ut-m line1 ulev-4"  onclick="openwin('detail.html')">保质期：3个月</li>
                    <li class="bc-text ub ub-ver ut-m line1 ulev-4" style="color:#c10802" onclick="openwin('detail.html')" >零售价：765元</li>
                    <li class="sc-text1 uinn3" >
                        <div class="ub umar-t ub-ac" style="color: gray">               
                            <div class="ub ub-pe ub-f1">
                                <div ontouchstart="appcan.touch('btn-act')" class=" uwh-pSC1 tx-c uba bc-border uc-a-app1 t-bla mar-ar1">-</div> 
                                <div class="uba uc-a-app1 bc-border uinput uwh-pSC1 mar-ar1 c-wh"><div placeholder="2" type="text" class="uinn-pSC3 t-bla tx-c">0</div></div>
                                <div ontouchstart="appcan.touch('btn-act')" class=" uwh-pSC1 tx-c uba bc-border uc-a-app1 t-bla">+</div> 
                            </div>
                        </div>
                    </li>
                </ul>    
            </ul>
        </li>
    </ul>
	-->
</div>
<div id="output"></div>
        <!-- Navbar -->
<div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default" id="">
      <ul class="am-navbar-nav am-cf am-avg-sm-4">
          <li >
            <a href="home.html" class="">
                <img src="images/home.png" alt="首页"/>
                <span class="am-navbar-label" >首页</span>
            </a>
          </li>
          <li >
            <a href="list.html" class="">
                <img src="images/pro-red.png" alt="微商城"/>
                <span class="am-navbar-label" style="color: #eb4f38;">微商城</span>
            </a>
          </li>
          <li >
            <a href="car.html" class="">
                <img src="images/car.png" alt="购物车"/>
                <span class="am-navbar-label">购物车</span>
            </a>
          </li>
          <li >
            <a href="set.html" class="">
                <img src="images/user.png" alt="个人中心"/>
                <span class="am-navbar-label">个人中心</span>
            </a>
          </li>
      </ul>
  </div>
     
 <script>
     function openwin(temp){
         window.location.href=temp;
     }
     
 </script>
           
      

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
</body>
</html>
